package com.hbwxz.admin.repo;

import com.hbwxz.admin.pojo.CommoditySku;
import com.hbwxz.admin.pojo.CommoditySkuUpError;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import javax.transaction.Transactional;
import java.util.List;

@Repository
public interface CommoditySkuUpErrorRepository extends JpaRepository<CommoditySkuUpError, Integer> {

    @Query(value = "select * from commodity_sku_up_error where epoch < 2 and status = 0",nativeQuery = true)
    List<CommoditySkuUpError> searchByEpochAndStatus();

    @Query(value = "update commodity_sku_up_error set epoch = ?2,status =?3 where skuId =?1",nativeQuery = true)
    void updateEpochAndStatus(Integer skuId,Integer epoch,Integer status);

}
